1. Field of the Invention
The present invention relates to an information processing apparatus having a hibernation function, and a method of controlling the same.
2. Description of the Related Art
With an increase in scale of software which forms a system, the time (start-up time) from when a power supply switch is turned on until system start-up is completed is prolonged. As one of solutions to a problem resulting from this prolongation of the start-up time, a hibernation technique is available.
In hibernation, information stored in a volatile memory (RAM) of a system is saved in a nonvolatile storage device such as a hard disk drive (HDD), an SSD (Solid State Drive), or a USB (Universal Serial Bus) memory before the power supply is shut down. Upon the next system start-up, the saved information is rewritten into the volatile memory to restore the system state before shutdown. In recent operating system (OS), hibernation is implemented by software to, for example, omit saving and restore processing of unnecessary information upon start-up, thereby shortening the restore time. In this hibernation, information is exchanged between a volatile memory and a nonvolatile storage device, so the access-speed of a device (generally, the nonvolatile storage device) having a low access speed considerably influences the hibernation processing time.
When the time required for normal system start-up processing, and the system restore time upon hibernation are compared with each other, and if the latter time is shorter, it is advantageous to use hibernation upon system start-up. In Japanese Patent Laid-Open No. 2009-146061, a determination as to whether the use of hibernation is advantageous is done by measuring the performance of a nonvolatile storage device serving as a save destination for information, and predicting the restore time upon hibernation, in accordance with the measured information. Based on this predicted restore time, it is decided whether the next system start-up operation is to be performed by hibernation.
However, conventionally, hibernation processing is performed in accordance with a predetermined procedure, independently of the performance of a nonvolatile storage device serving as a save destination for hibernation data. This poses a problem that processing specialized for the nonvolatile storage device is not performed. For example, an HDD accesses information stored in a magnetic disk as the internal head mechanically operates. Therefore, the HDD has a structural feature that the number of mechanical operations increases as pieces of information to be accessed are fragmented more on the magnetic disk, and the access speed to the information lowers. On the other hand, an SSD accesses stored information by electrical processing, and therefore can access the information at a constant access speed independently of the degree of fragmentation of pieces of information.
When, for example, an HDD is used as a save destination for hibernation data in consideration of the above-mentioned feature of a nonvolatile storage device, it is desirable to suppress fragmentation of hibernation data so as not to lower the access speed. In the case of, for example, Linux, the mechanism of a swap file, in which part of hibernation data is saved in an unused memory area, and restored in the memory where necessary, is employed. Because swap file restore processing is performed for each minimum size in terms of memory management, random access occurs a number of times equal to a value obtained by dividing the area to be restored by the minimum size. Therefore, when an HDD is used, it is desirable not to perform restore processing using a swap file as much as possible.